Lifecycle of the document extension on the linked element creation

VDoc lets you declare extensions that will be called when an internal resource (or a linked process) is created.

The interest of such an extension class is to enable treatments on the linked element fields by accessing to the parent document.

To create a link extension class, create a Java class that implements the basic class named : com.axemble.vdoc.sdk.link.extensions.BaseLinkExtension.

For the deployed class to be called, you just have to define it on the form containing the table.

Methods of the BaseLinkExtension class

 
public abstract class BaseLinkExtension implements ILinkExtension
{
        // helper method
        protected IWorkflowModule getWorkflowModule():
        
        // method to implement
        public abstract boolean onCreate( IWorkflowInstance workflowInstance, IResource resource );
}

Code extract of the CopyLinkExtension class

This example shows the copying of the main document value to a dynamic table field.

public class CopyLinkExtension extends BaseLinkExtension
{
        private static final long serialVersionUID = 4291330280452507689L;

        public boolean onCreate( IWorkflowInstance workflowInstance, IResource resource )
        {
                // assignment of the value of the "Comments2" field with the value of the field "Comments" of the parent document
                resource.setValue( "Commentaires2", workflowInstance.getValue( "Commentaires" ) );

                return true;
        }
}